<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>物料清单</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../res/css/layui.css" media="all">
<link rel="stylesheet" href="../../res/css/cst/snproduction.css"
	media="all">
<script type="text/javascript" src="../../res/js/jquery-1.11.2.min.js"></script>
<style>
#snBom tr td, #snBom tr th {
	text-align: center;
}

#snBom {
	margin-bottom: 40px;
}

.materNumber {
	width: 200px;
	height: 28px;
	border: none;
	text-align: center;
}

.materSum {
	width: 200px;
	height: 28px;
	border: none;
	text-align: center;
	color: gray;
	opacity: 0.8;
}
</style>
</head>
<body>
	<span style="float: right; margin-right: 100px; color: gray;">——————<span
		id="bomCommont"></span></span>
	<div class="demoTable" style="margin-left: 20px; margin-top: 10px;">
		<button class="layui-btn layui-btn-sm" id="selectButton"
			data-type="getCheckData">确认保存</button>
		<button class="layui-btn layui-btn-danger layui-btn-sm"
			onclick="exit();">取消</button>
	</div>
	<table class="layui-table" id="snBom" lay-filter="demo">
		<thead>
			<tr>
				<th>材料编号</th>
				<th>材料名称</th>
				<th>需要数量</th>
				<th>材料单位</th>
				<th
					lay-data="{fixed: 'right',fixed: 'right',width:'79', align:'center', toolbar: '#barDemo'}">操作</th>
			</tr>
		</thead>
		<tbody id="snBomBody">

		</tbody>
	</table>

	<script type="text/html" id="barDemo">
	 <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>
</script>



	<div id="insertBom" style="margin-top: 20px;">

		<div class="demoTable" style="margin-left: 20px; margin-top: 10px;">
			<from class="layui-form" id="selectFrom"> 材料名称:
			<div class="layui-inline">
				<input class="layui-input" style="height: 32px; width: 150px;" maxlength="7"
					id="maName" placeholder="请输入材料名称" autocomplete="off">
			</div>
			材料类型:
			<div class="layui-inline">
				<select lay-filter="aihao" id="typeSelect" style="width: 100px;">

				</select>
			</div>
			</from>

			<button class="layui-btn layui-btn-sm" data-type="reload"
				id="selectCom">搜索</button>

		</div>
		<input type="hidden" id="materInput">
		<table id="AddCom" class="layui-hide" lay-filter="AddCom">
			<thead>
			</thead>
		</table>
		<script src="../../res/layui.all.js" charset="utf-8"></script>
		<script type="text/javascript">
			layui.use('table', function() {
				var table = layui.table;
				table.render({
					elem : '#AddCom',
					page : true,
					url : '../../materials/findAll.action',
					cellMinWidth : 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
					,
					cols : [ [ {
						type : 'checkbox',
						sort : true
					}, {
						field : 'maId',
						title : '材料id',
						sort : true,
						align : 'center'
					}, {
						field : 'typeName',
						title : '材料类型',
						sort : true,
						align : 'center'
					}, {
						field : 'maName',
						title : '材料名称',
						align : 'center'
					}, {
						field : 'maMoney',
						title : '材料价格',
						sort : true,
						align : 'center'
					}, {
						field : 'maUnit',
						title : '材料单位',
						align : 'center'
					}, {
						field : 'firmName',
						title : '生产厂商',
						align : 'center'
					} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
					] ]//表格加载完成的回调函数
					,
					done : function(res, curr, count) {
						setTimeout(function(){
							$.each($(".purchasemaid"),function(i,info){
								$.each($(".layui-table-col-special"),function(index,item){
									var name=$(item).next().children().html();
									if(name==$(info).html()){
										var check=$(item).children().children(":first").get(0);
										$(check).attr({"checked":true});
										load();
									}
								});
							});
						},100);
					}
				});
			});
		</script>
	</div>

	<script type="text/javascript" src="../../res/js/cst/snbom.js"></script>
</body>
</html>